// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/account/center',
    children: [
      {
        path: '/account',
        component: RouteView,
        redirect: '/account/center',
        name: 'account',
        meta: { title: '个人管理', icon: 'user', keepAlive: true, permission: [ 'account' ] },
        children: [
          {
            path: '/account/center',
            name: 'center',
            component: () => import('@/pages/common/account/center/Index'),
            meta: { title: '个人中心', keepAlive: true, permission: [ 'center' ] }
          }
        ]
      },
      {
        path: '/system',
        name: 'system',
        redirect: '/system/menu',
        component: PageView,
        meta: { title: '系统管理', icon: 'setting', permission: [ 'system' ] },
        children: [
          {
            path: '/system/user',
            name: 'user',
            component: () => import('@/pages/system/user/List'),
            meta: { title: '用户管理', keepAlive: true, permission: [ 'user' ] }
          },
          {
            path: '/system/menu',
            name: 'menu',
            component: () => import('@/pages/system/menu/List'),
            meta: { title: '菜单管理', keepAlive: true, permission: [ 'menu' ] }
          },
          {
            path: '/system/role',
            name: 'role',
            component: () => import('@/pages/system/role/List'),
            meta: { title: '角色管理', keepAlive: true, permission: [ 'role' ] }
          },
          {
            path: '/system/category',
            name: 'category',
            component: () => import('@/pages/system/category/List'),
            meta: { title: '类别管理', keepAlive: true, permission: [ 'category' ] }
          }
        ]
      },
      {
        path: '/companyService',
        name: 'companyService',
        redirect: '/companyService/company',
        component: PageView,
        meta: { title: '厂商管理', icon: 'shop', permission: [ 'manufacturerService' ] },
        children: [
          {
            path: '/companyService/company',
            name: 'company',
            component: () => import('@/pages/companyService/company/List'),
            meta: { title: '厂商', keepAlive: true, permission: [ 'manufacturer' ] }
          },
          {
            path: '/companyService/companyUser',
            name: 'companyUser',
            component: () => import('@/pages/companyService/companyUser/List'),
            meta: { title: '厂商用户', keepAlive: true,permission: [ 'manufacturerUser' ]}
          }
        ]
      },
      {
        path: '/businessService',
        name: 'businessService',
        redirect: '/businessService/business',
        component: PageView,
        meta: { title: '服务商管理', icon: 'book', permission: [ 'business' ] },
        children: [
          {
            path: '/businessService/business',
            name: 'business',
            component: () => import('@/pages/businessService/business/List'),
            meta: { title: '服务商', keepAlive: true,permission: [ 'business' ]}
          },
          {
            path: '/businessService/businessUser',
            name: 'businessUser',
            component: () => import('@/pages/businessService/businessUser/List'),
            meta: { title: '服务商用户', keepAlive: true,permission: [ 'businessUser' ]}
          },
          {
            path: '/businessService/order',
            name: 'order',
            component: () => import('@/pages/businessService/order/List'),
            meta: { title: '交易记录', keepAlive: true,permission: [ 'order' ]}
          }
        ]
      },

      {
        path: '/merchantService',
        name: 'merchantService',
        redirect: '/merchantService/merchant',
        component: PageView,
        meta: { title: '商户管理', icon: 'shop', permission: [ 'merchant' ] },
        children: [
          {
            path: '/merchantService/merchant',
            name: 'merchant',
            component: () => import('@/pages/merchantService/merchant/List'),
            meta: { title: '商户', keepAlive: true,permission: [ 'merchant' ]}
          }
        ]
      },


      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        redirect: '/exception/403',
        meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
        children: [
          {
            path: '/exception/403',
            name: 'Exception403',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/403'),
            meta: { title: '403', permission: [ 'exception' ] }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404'),
            meta: { title: '404', permission: [ 'exception' ] }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/500'),
            meta: { title: '500', permission: [ 'exception' ] }
          }
        ]
      }
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/RegisterResult')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404')
  }
]
